package com.pinusmusic.dao.impl;

import com.pinusmusic.dao.MusicStyleDao;
import com.pinusmusic.domain.MusicStyle;
import com.pinusmusic.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class MusicStyleDaoImpl implements MusicStyleDao {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    @Override
    public List<MusicStyle> findAllStyle() {
        String sql = "select * from musicstyle";
        return template.query(sql,new BeanPropertyRowMapper<>(MusicStyle.class));
    }
}
